home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 1.4 KB | 66 lines | [TEXT/CWIE] |
- // MenuObject.h
-
- #ifndef MenuObject_h
- #define MenuObject_h
-
- #ifndef ResourceID_h
- #include "ResourceID.h"
- #endif
- #ifndef MenuItem_h
- #include "MenuItem.h"
- #endif
- #ifndef Assert_h
- #include "Assert.h"
- #endif
- #ifndef Range_h
- #include "Range.h"
- #endif
- #ifndef MenuManagerUser_h
- #include "MenuManagerUser.h"
- #endif
-
- class MenuObject: public MenuManagerUser
- {
- private:
- MenuHandle menu;
- uint16 length;
- const MenuID id;
-
- public:
- MenuObject( MenuID, ConstPString title );
- MenuObject( MenuHandle );
- MenuObject( ResourceID );
-
- uint16 Length() const { return length; }
-
- MenuID ID() const { return id; }
- MenuHandle Handle() const { return menu; }
- operator MenuHandle() const { return menu; }
-
- MenuItem operator[]( uint16 i )
- { Assert( i < length ); return MenuItem( menu, i+1 ); }
-
- void InsertItem( uint16 index, ConstPString text );
- void AppendItem( ConstPString text );
-
- void InsertDivider( uint16 index );
- void AppendDivider();
-
- void InsertResources( uint16 index, ResType );
- void AppendResources( ResType type );
-
- void DeleteItem( uint16 index );
- void DeleteItems( URange16 items );
-
- bool Enabled() const { return ( (*menu)->enableFlags & 1 ) != 0; }
- void Enable();
- void Disable();
- void EnableIfItemsEnabled();
-
- bool TailEnabled() const { return ( (*menu)->enableFlags & 0x80000000 ) != 0; }
- void EnableTail();
- void DisableTail();
- };
-
- #endif
-